<?php

class FileUtils
{
	public static function prefixFilename($value)
	{
		$filename = substr(uniqid(md5(microtime())),0,6).'-'.$value;
		return $filename;
	}
	
	public static function updateFile($fileData, $filenameWithPath)
	{	
		$filenameWithPath = $_SERVER['DOCUMENT_ROOT']."/".$filenameWithPath;
		move_uploaded_file($fileData['tmp_name'], $filenameWithPath);
	}
	
	public static function delete($filenameWithPath)
	{
		$filenameWithPath = $_SERVER['DOCUMENT_ROOT']."/".$filenameWithPath;
		
		if (is_file($filenameWithPath))
			unlink ($filenameWithPath);
	}
}
?>
